<%@include file="/commons/decelerations.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<c:set var="submitButtonName">
	<c:choose>
		<c:when test='${action eq "CreateRole"}'>Create Role</c:when>
		<c:otherwise>Maintain Role</c:otherwise>
	</c:choose>
</c:set>

<form action="${action}" method="post" id="form">
	<table>
		<c:choose>
			<c:when test='${action eq "CreateRole"}'>
       			<tr><td>Role Id</td><td><input type="text" id = "roleId" name="roleId" value="${role.roleId}"/></td></tr>
       		</c:when>
       		<c:otherwise>
       			<tr><td>Role Id</td><td><input type="text" id = "roleId" name="roleId" value="${role.roleId}" readonly="readonly"/></td></tr>
       		</c:otherwise>
     	</c:choose>

       	<tr><td>Role Name</td><td><input type="text" id = "roleName" name="roleName" value="${role.roleName}"/></td></tr>
       	<tr><td>&nbsp;</td></tr>
       	<tr>
       		<td><input type="button" onClick="CheckEmpty()" value="${submitButtonName}"/></td>
       		<td><button type="reset">Reset</button></td>
       	</tr>
   	</table>
</form>

<script type="text/javascript">
	function CheckEmpty()
	{				
		if (form.roleId.value.length == 0 || form.roleName.value.length == 0)
			{
				alert("Do not leave blanks, thank you.");
			}
		else
			{
				form.submit();
			}
	}
</script>

<c:if test='${warning eq 0}'>
	<script type="text/javascript">
		
		alert("Role Id = '" + form.roleId.value + "' is already exist.");
		
	</script>
</c:if>



